﻿@page "/q"
@model Dotnet9.Web.Pages.BlogPosts.QueryModel
@inject IOptionsSnapshot<SiteOptions> SiteOptions
@{
    ViewData["Title"] = "搜索";
}

<div class="pics-list-box whitebg">
    <div class="news-title">
        <span class="weizhi">联系请关注微信公众号：@SiteOptions.Value.WechatPublic1Name</span>
        <h2>查询关键字：@Model?.Keywords</h2>
    </div>
    @if (Model?.BlogPosts == null || !Model.BlogPosts.Any())
    {
        <p>没有您查找的结果</p>
    }
    else
    {
        <ul>
            @foreach (var item in Model.BlogPosts)
            {
                <li>
                    <a href="/@item.CreationTime.ToString("yyyy/MM")/@item.Slug">
                        <i>
                            <img src="@item.Cover" alt="@item.Title">
                        </i>
                        <h2>@item.Title</h2>
                        <p>@item.Description</p>
                    </a>
                </li>
            }
        </ul>
        @await Html.PartialAsync("_PaginationPartial", new PaginationModel(Model.Current, Model.Pages, Model.Total, Model.PageSize, Model.PageCount,$"keywords={Model.Keywords}"))
    }
</div>